<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<style>
 	video::-webkit-media-controls {
	  display:none !important;
	}
</style>
<body style="overflow: hidden;">
	<video id="video" controls="controls" muted playsinline="true" ></video>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript" charset="utf-8"></script>
	<script>
	    var video = document.getElementById('video');
	
	     //访问摄像头
	    if (navigator.mediaDevices.getUserMedia || navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia) {
	        //调用用户媒体设备, 访问摄像头
	        getUserMedia({video: {width: 330, height: 212}}, success, error);
	    } else {
	        alert('不支持访问用户媒体');
	    }
	    
	     //访问用户媒体设备的兼容方法
	    function getUserMedia(constraints, success, error) {
	        if (navigator.mediaDevices.getUserMedia) {
	            //最新的标准API
	            navigator.mediaDevices.getUserMedia(constraints).then(success).catch(error);
	        } else if (navigator.webkitGetUserMedia) {
	            //webkit核心浏览器
	            navigator.webkitGetUserMedia(constraints, success, error)
	        } else if (navigator.mozGetUserMedia) {
	            //firfox浏览器
	            navigator.mozGetUserMedia(constraints, success, error);
	        } else if (navigator.getUserMedia) {
	            //旧版API
	            navigator.getUserMedia(constraints, success, error);
	        }
	    }
	
	    //成功回调
	    function success(stream) {
	        //兼容webkit核心浏览器
	        var CompatibleURL = window.URL || window.webkitURL;
	        //将视频流设置为video元素的源
	        // console.log(stream);
	        //video.src = CompatibleURL.createObjectURL(stream);
	        video.srcObject = stream;
	        video.play();
	    }
	
	    //失败回调
	    function error(error) {
	        console.log("访问用户媒体设备失败");
	    }
	
	    document.addEventListener("WeixinJSBridgeReady",function() { 
	    	document.getElementById('vido').play(); 
	    }, false);
	</script>
</body>
</html>